<script type="text/javascript" src="js/getParameter.js"></script>
<script>
    $(function () {
        //发送异步请求，获取用户的信息
        $.get("user/findUserServlet",{},function (data) {

            $("#login_span").html("欢迎回来！"+data.name);

        });
        //获取分类条目(首页和收藏排行榜是固定的)
        $.get("category/findAll",{},function (data) {
            //[{"cid":1,"cname":"门票"},{"cid":1,"cname":"门票"},{"cid":1,"cname":"门票"}]
            var lis='<li class="nav-active"><a href="index.html">首页</a></li>';
            //遍历json数组进行拼接数据
            for (var i = 0; i < data.length; i++) {
                lis+='<li><a href="route_list.html?cid='+data[i].cid+'">'+data[i].cname+'</a></li>';
            }
            lis+='<li><a href="favoriterank.html">收藏排行榜</a></li>';
            $("#category").html(lis);

        });
        //搜索查询
        $("#search-button").click(function () {
            //获取模糊查询的值
            var rname = $("#search_input").val();
            var cid = getParameter("cid");
            location.href="http://localhost/travel/route_list.html?cid="+cid+"&rname="+rname;
        })

    });
</script>
<!-- 头部 start -->
    <header id="header">
        <div class="top_banner">
            <img src="images/top_banner.jpg" alt="">
        </div>
        <div class="shortcut">
            <!-- 未登录状态  -->
            <div class="login_out">
                <a href="login.html">登录</a>
                <a href="register.html">注册</a>
            </div>
            <!-- 登录状态  -->
            <div class="login">
            	
                <span id="login_span"></span>
                <a href="myfavorite.html" class="collection">我的收藏</a>
                <a href="javascript:location.href='user/exitServlet';">退出</a>
            </div>
        </div>
        <div class="header_wrap">
            <div class="topbar">
                <div class="logo">
                    <a href="/"><img src="images/logo.jpg" alt=""></a>
                </div>
                <div class="search">
                    <input name="cname" id="search_input" type="text" placeholder="请输入路线名称" class="search_input" autocomplete="off">
                    <a href="javascript:void(0);" class="search-button" id="search-button">搜索</a>
                </div>
                <div class="hottel">
                    <div class="hot_pic">
                        <img src="images/hot_tel.jpg" alt="">
                    </div>
                    <div class="hot_tel">
                        <p class="hot_time">客服热线(9:00-6:00)</p>
                        <p class="hot_num">400-618-9090</p>
                    </div>
                </div>
            </div>
        </div>
    </header>
    <!-- 头部 end -->
     <!-- 首页导航 -->
    <div class="navitem">
        <ul class="nav" id="category">
            <!--<li class="nav-active"><a href="index.html">首页</a></li>
            <li><a href="route_list.html">门票</a></li>
            <li><a href="route_list.html">酒店</a></li>
            <li><a href="route_list.html">香港车票</a></li>
            <li><a href="route_list.html">出境游</a></li>
            <li><a href="route_list.html">国内游</a></li>
            <li><a href="route_list.html">港澳游</a></li>
            <li><a href="route_list.html">抱团定制</a></li>
            <li><a href="route_list.html">全球自由行</a></li>
            <li><a href="favoriterank.html">收藏排行榜</a></li>-->
        </ul>
    </div>
    